package 复合模式;

import java.util.ArrayList;
import java.util.List;

/**
 * @author zzs
 * @ClassName OneQuack.java
 * @Description
 * @createTime 2022年05月21日 10:01:00
 */
public class OneDuck implements Duck, Observer{
    public Observable observable;

    public OneDuck() {
    }

    public OneDuck(Observable observable) {
        this.observable = observable;

    }

    @Override
    public void quack() {
        System.out.println("鸭子叫");
        // 注册主题
        observable.registerObserver(this);
    }

    @Override
    public void update() {
        System.out.println("这个" + this + "叫了");
    }
}
